home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 July: Mac OS SDK / Dev.CD Jul 99 SDK1.toast / Development Kits / Mac OS / Interfaces&Libraries / Universal / Interfaces / CIncludes / ATSUnicode.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  32.3 KB  |  951 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        ATSUnicode.h
  3.  
  4.      Contains:    Public interfaces for Apple Type Services for Unicode Imaging
  5.  
  6.      Version:    Technology:    Allegro
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1997-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __ATSUNICODE__
  18. #define __ATSUNICODE__
  19.  
  20. #ifndef __ATSLAYOUTTYPES__
  21. #include <ATSLayoutTypes.h>
  22. #endif
  23. #ifndef __SFNTLAYOUTTYPES__
  24. #include <SFNTLayoutTypes.h>
  25. #endif
  26.  
  27. #ifndef __MACTYPES__
  28. #include <MacTypes.h>
  29. #endif
  30. #ifndef __QUICKDRAW__
  31. #include <Quickdraw.h>
  32. #endif
  33. #ifndef __TEXTCOMMON__
  34. #include <TextCommon.h>
  35. #endif
  36.  
  37.  
  38.  
  39. #if PRAGMA_ONCE
  40. #pragma once
  41. #endif
  42.  
  43. #ifdef __cplusplus
  44. extern "C" {
  45. #endif
  46.  
  47. #if PRAGMA_IMPORT
  48. #pragma import on
  49. #endif
  50.  
  51. #if PRAGMA_STRUCT_ALIGN
  52.     #pragma options align=mac68k
  53. #elif PRAGMA_STRUCT_PACKPUSH
  54.     #pragma pack(push, 2)
  55. #elif PRAGMA_STRUCT_PACK
  56.     #pragma pack(2)
  57. #endif
  58.  
  59. /************/
  60. /*    Types    */
  61. /************/
  62. typedef UniCharArrayPtr *                UniCharArrayHandle;
  63. /*
  64.       UniCharArrayHandle is a handle type to correspond to 
  65.       UniCharArrayPtr, defined in Unicode.h.  It refers 
  66.       to a handle, interpreted as a pointer to an array 
  67.       of UniChar's (UInt16's).
  68. */
  69. typedef UInt32                             UniCharArrayOffset;
  70. /*
  71.       UniCharArrayOffset is used to indicate an offset 
  72.       into an array of UniChar's (UInt16's).  
  73. */
  74. typedef Fixed                             ATSUTextMeasurement;
  75. /*
  76.       ATSUTextMeasurement is exactly what its name implies:  
  77.       a measurement of the size in some direction of text:  
  78.       height, width, ascent, descent, and so on.  
  79. */
  80. typedef UInt32                             ATSUFontID;
  81. /*
  82.       ATSUFontID indicates a particular font family and face.  
  83.       ATSUFontID's are not guaranteed to remain constant across 
  84.       reboots.  Clients should use the font's unique name to 
  85.       get a font token to store in documents which is 
  86.       guaranteed to remain constant across reboots. 
  87. */
  88. typedef UInt16                             ATSUFontFeatureType;
  89. typedef UInt16                             ATSUFontFeatureSelector;
  90. /*
  91.       ATSUFontFeatureType and ATSUFontFeatureSelector are used 
  92.       to identify font features.  
  93. */
  94. typedef FourCharCode                     ATSUFontVariationAxis;
  95. typedef Fixed                             ATSUFontVariationValue;
  96. /*
  97.       ATSUFontVariationAxis and ATSUFontVariationValue are used 
  98.       in connection with font variations.  
  99. */
  100. typedef struct OpaqueATSUTextLayout*     ATSUTextLayout;
  101. /*
  102.       ATSUTextLayout is used to store the attribute information 
  103.       associated with a contiguous block of UniChar's (UInt16's) 
  104.       in memory.  It's typed to be an opaque structure.  
  105. */
  106. typedef struct OpaqueATSUStyle*         ATSUStyle;
  107. /*
  108.       ATSUStyle is used to store a set of individual attributes, 
  109.       font features, and font variations.  It's typed to be 
  110.       an opaque structure.  
  111. */
  112. typedef UInt32                             ATSUAttributeTag;
  113. /*
  114.       ATSUAttributeTag is used to indicate the particular type 
  115.       of attribute under consideration:  font, size, color, 
  116.       and so on.  
  117.       Each style run may have at most one attribute with a 
  118.       given ATSUAttributeTag (i.e., a style run can't have 
  119.       more than one font or size) but may have none.  
  120. */
  121. typedef void *                            ATSUAttributeValuePtr;
  122. /*
  123.       ATSUAttributeValuePtr is used to provide generic access 
  124.       to storage of attribute values, which vary in size.
  125. */
  126.  
  127. struct ATSUAttributeInfo {
  128.     ATSUAttributeTag                 fTag;
  129.     ByteCount                         fValueSize;
  130. };
  131. typedef struct ATSUAttributeInfo        ATSUAttributeInfo;
  132. /*
  133.       ATSUAttributeInfo is used to provide a tag/size pairing.  
  134.       This makes it possible to provide the client information   
  135.       about all the attributes for a given range of text.  This   
  136.       structure is only used to return to the client information   
  137.       about a complete set of attributes.  An array of   
  138.       ATSUAttributeInfos is passed as a parameter so that the   
  139.       client can find out what attributes are set and what their   
  140.       individual sizes are; with that information, they can then   
  141.       query about the values of the attributes they're interested   
  142.       in.  Because arrays of ATSUAttributeInfos are used as parameters   
  143.       to functions, they have to be of a fixed size, hence the   
  144.       value is not included in the structure.  
  145. */
  146.  
  147. struct ATSUCaret {
  148.     Fixed                             fX;
  149.     Fixed                             fY;
  150.     Fixed                             fDeltaX;
  151.     Fixed                             fDeltaY;
  152. };
  153. typedef struct ATSUCaret                ATSUCaret;
  154. /*
  155.       ATSUCaret contains the complete information needed to render a
  156.       caret.  fX and fY is the position of one of the caret's ends
  157.       relative to the origin position of the line the caret belongs.
  158.       fDeltaX and fDeltaY is the position of the caret's other end.
  159.       Hence, to draw a caret, simply call MoveTo(fX, fY) followed by
  160.       LineTo(fDeltaX, fDeltaY) or equivalent.  The ATSUCaret will
  161.       contain the positions needed to draw carets on angled lines
  162.       and reflect angled carets and leading/trailing split caret
  163.       appearances.
  164. */
  165.  
  166. typedef int                             ATSUCursorMovementType;
  167. /*
  168.       ATSUCursorMovementType currently can take three values 
  169.       (kATSUByCharacter, kATSUByCluster, and kATSUByWord) 
  170.       and is used to indicate how much to move the cursor.  
  171. */
  172. typedef UInt16                             ATSUVerticalCharacterType;
  173. /*
  174.       ATSUVerticalCharacterType currently can take two values 
  175.       (kATSUStronglyVertical, and kATSUStronglyHorizontal) and 
  176.       is used to indicate whether text is to be laid out as 
  177.       vertical glyphs or horizontal glyphs.  
  178. */
  179. typedef UInt16                             ATSUStyleComparison;
  180. /*
  181.       ATSUStyleComparison is an enumeration with four values 
  182.       (kATUStyleUnequal, ATSUStyleContains, kATSUStyleEquals, 
  183.       and kATSUStyleContainedBy), and is used by ATSUCompareStyles() 
  184.       to indicate if the first style parameter contains as a 
  185.       proper subset, is equal to, or is contained by the second 
  186.       style parameter.
  187. */
  188. /****************************************************/
  189. /*    Gestalt selectors                                */
  190. /*        Move into Gestalt.i when they're stable!!!!    */
  191. /****************************************************/
  192.  
  193. enum {
  194.     gestaltATSUVersion            = FOUR_CHAR_CODE('uisv'),
  195.     gestaltATSUFeatures            = FOUR_CHAR_CODE('uisf')
  196. };
  197.  
  198.  
  199. enum {
  200.     gestaltOriginalATSUVersion    = (1 << 16)
  201. };
  202.  
  203. /****************/
  204. /*    Error codes    */
  205. /****************/
  206.  
  207. enum {
  208.     kATSUInvalidTextLayoutErr    = -8790,                        /*    An attempt was made to use a ATSUTextLayout */
  209.                                                                 /*    which hadn't been initialized or is otherwise */
  210.                                                                 /*    in an invalid state. */
  211.     kATSUInvalidStyleErr        = -8791,                        /*    An attempt was made to use a ATSUStyle which  */
  212.                                                                 /*    hadn't been properly allocated or is otherwise  */
  213.                                                                 /*    in an invalid state.  */
  214.     kATSUInvalidTextRangeErr    = -8792,                        /*    An attempt was made to extract information   */
  215.                                                                 /*    information from or perform an operation on a   */
  216.                                                                 /*    ATSUTextLayout for a range of text not covered   */
  217.                                                                 /*    by the ATSUTextLayout.  */
  218.     kATSUFontsMatched            = -8793,                        /*    This is not an error code but is returned by    */
  219.                                                                 /*    ATSUMatchFontsToText() when changes need to    */
  220.                                                                 /*    be made to the fonts associated with the text.  */
  221.     kATSUFontsNotMatched        = -8794,                        /*    This value is returned by ATSUMatchFontsToText()    */
  222.                                                                 /*    when the text contains Unicode characters which    */
  223.                                                                 /*    cannot be represented by any installed font.  */
  224.     kATSUNoCorrespondingFontErr    = -8795,                        /*    This value is retrned by font ID conversion */
  225.                                                                 /*    routines ATSUFONDtoFontID() and ATSUFontIDtoFOND() */
  226.                                                                 /*    to indicate that the input font ID is valid but */
  227.                                                                 /*    there is no conversion possible.  For example, */
  228.                                                                 /*    data-fork fonts can only be used with ATSUI not */
  229.                                                                 /*    the FontManager, and so converting an ATSUIFontID */
  230.                                                                 /*    for such a font will fail.   */
  231.     kATSUInvalidFontErr            = -8796,                        /*    Used when an attempt was made to use an invalid font ID.*/
  232.     kATSUInvalidAttributeValueErr = -8797,                        /*    Used when an attempt was made to use an attribute with */
  233.                                                                 /*    a bad or undefined value.  */
  234.     kATSUInvalidAttributeSizeErr = -8798,                        /*    Used when an attempt was made to use an attribute with a */
  235.                                                                 /*    bad size.  */
  236.     kATSUInvalidAttributeTagErr    = -8799,                        /*    Used when an attempt was made to use a tag value that*/
  237.                                                                 /*    was not appropriate for the function call it was used.  */
  238.     kATSUInvalidCacheErr        = -8800,                        /*    Used when an attempt was made to read in style data */
  239.                                                                 /*    from an invalid cache.  Either the format of the */
  240.                                                                 /*    cached data doesn't match that used by Apple Type */
  241.                                                                 /*    Services for Unicode™ Imaging, or the cached data */
  242.                                                                 /*    is corrupt.  */
  243.     kATSUNotSetErr                = -8801,                        /*    Used when the client attempts to retrieve an attribute, */
  244.                                                                 /*    font feature, or font variation from a style when it */
  245.                                                                 /*    hadn't been set.  In such a case, the default value will*/
  246.                                                                 /*    be returned for the attribute's value.*/
  247.     kATSUNoStyleRunsAssignedErr    = -8802,                        /*    Used when an attempt was made to measure, highlight or draw*/
  248.                                                                 /*    a ATSUTextLayout object that has no styleRuns associated with it.*/
  249.                                                                 /*    Used when QuickDraw Text encounters an error rendering or measuring*/
  250.     kATSUQuickDrawTextErr        = -8803                            /*    a line of ATSUI text.*/
  251. };
  252.  
  253. /*******************************************************************************/
  254. /*    ATSUI Attribute tags:  Apple reserves values 0 to 65,535 (0 to 0x0000FFFF) */
  255. /*    ATSUI clients may create their own tags with any other value               */
  256. /*******************************************************************************/
  257. /*    Line Control Attribute Tags */
  258.  
  259. enum {
  260.     kATSULineWidthTag            = 1L,                            /*    Type:            ATSUTextMeasurement*/
  261.                                                                 /*    Default value:    0*/
  262.     kATSULineRotationTag        = 2L,                            /*    Type:            Fixed (fixed value in degrees in right-handed coordinate system)*/
  263.                                                                 /*    Default value:    0*/
  264.     kATSULineDirectionTag        = 3L,                            /*    Type:            Boolean; values 0 or 1 (see below for value identities)*/
  265.                                                                 /*    Default value:    kATSULeftToRightBaseDirection*/
  266.     kATSULineJustificationFactorTag = 4L,                        /*    Type:            Fract between 0 and 1*/
  267.                                                                 /*    Default value:    kATSUNoJustification*/
  268.     kATSULineFlushFactorTag        = 5L,                            /*    Type:            Fract between 0 and 1 */
  269.                                                                 /*    Default value:    kATSUStartAlignment*/
  270.     kATSULineBaselineValuesTag    = 6L,                            /*    Type:            BslnBaselineRecord*/
  271.                                                                 /*    Default value:    All zeros.  Calculated from other style attributes (e.g., font and point size)*/
  272.                                                                 /*    Type:            UInt32*/
  273.     kATSULineLayoutOptionsTag    = 7L                            /*    Default value:    kATSUNoLayoutOptions - other options listed in ATSLayoutTypes.h*/
  274. };
  275.  
  276. /*    Run Style Attribute Tags */
  277.  
  278. enum {
  279.                                                                 /* QuickDraw compatibility tags */
  280.     kATSUQDBoldfaceTag            = 256L,                            /*    Type:            Boolean    */
  281.                                                                 /*    Default value:    false*/
  282.     kATSUQDItalicTag            = 257L,                            /*    Type:            Boolean        */
  283.                                                                 /*    Default value:    false*/
  284.     kATSUQDUnderlineTag            = 258L,                            /*    Type:            Boolean    */
  285.                                                                 /*    Default value:    false*/
  286.     kATSUQDCondensedTag            = 259L,                            /*    Type:            Boolean    */
  287.                                                                 /*    Default value:    false*/
  288.     kATSUQDExtendedTag            = 260L,                            /*    Type:            Boolean    */
  289.                                                                 /*    Default value:    false*/
  290.                                                                 /* Common run tags */
  291.     kATSUFontTag                = 261L,                            /*    Type:            ATSUFontID    */
  292.                                                                 /*    Default value:    GetScriptVariable( smSystemScript, smScriptAppFond )*/
  293.     kATSUSizeTag                = 262L,                            /*    Type:            Fixed    */
  294.                                                                 /*    Default value:    GetScriptVariable( smSystemScript, smScriptAppFondSize )    */
  295.     kATSUColorTag                = 263L,                            /*    Type:            RGBColor    */
  296.                                                                 /*    Default value:    (0, 0, 0)*/
  297.     kATSULanguageTag            = 264L,                            /*    Type:            RegionCode    */
  298.                                                                 /*    Default value:    GetScriptVariable( smSystemScript, smScriptLang )*/
  299.                                                                 /*    Less common run tags */
  300.     kATSUVerticalCharacterTag    = 265L,                            /*    Type:            ATSUVerticalCharacterType    */
  301.                                                                 /*    Default value:    kATSUStronglyHorizontal*/
  302.     kATSUImposeWidthTag            = 266L,                            /*    Type:            ATSUTextMeasurement*/
  303.                                                                 /*    Default value:    all glyphs use their own font defined advance widths*/
  304.     kATSUBeforeWithStreamShiftTag = 267L,                        /*    Type:            Fixed*/
  305.                                                                 /*    Default value:    0*/
  306.     kATSUAfterWithStreamShiftTag = 268L,                        /*    Type:            Fixed*/
  307.                                                                 /*    Default value:    0*/
  308.     kATSUCrossStreamShiftTag    = 269L,                            /*    Type:            Fixed*/
  309.                                                                 /*    Default value:    0*/
  310.     kATSUTrackingTag            = 270L,                            /*    Type:            Fixed*/
  311.                                                                 /*    Default value:    0*/
  312.     kATSUHangingInhibitFactorTag = 271L,                        /*    Type:            Fract between 0 and 1*/
  313.                                                                 /*    Default value:    0*/
  314.     kATSUKerningInhibitFactorTag = 272L,                        /*    Type:            Fract between 0 and 1*/
  315.                                                                 /*    Default value:    0*/
  316.     kATSUDecompositionFactorTag    = 273L,                            /*    Type:            Fixed (-1.0 -> 1.0)*/
  317.                                                                 /*    Default value:    0*/
  318.     kATSUBaselineClassTag        = 274L,                            /*    Type:            BslnBaselineClass  (see SFNTLayoutTypes.h)*/
  319.                                                                 /*    Default value:    kBSLNNoBaselineOverride*/
  320.     kATSUPriorityJustOverrideTag = 275L,                        /*    Type:            ATSJustPriorityWidthDeltaOverrides (see ATSLayoutTypes.h)*/
  321.                                                                 /*    Default value:    all zeros*/
  322.     kATSUNoLigatureSplitTag        = 276L,                            /*    Type:            Boolean*/
  323.                                                                 /*    Default value:    false - ligatures and compound characters have divisable components.*/
  324.     kATSUNoCaretAngleTag        = 277L,                            /*    Type:            Boolean*/
  325.                                                                 /*    Default value:    false - use the character's angularity to determine its boundaries*/
  326.     kATSUSuppressCrossKerningTag = 278L,                        /*    Type:            Boolean*/
  327.                                                                 /*    Default value:    false - do not suppress automatic cross kerning (defined by font)*/
  328.     kATSUNoOpticalAlignmentTag    = 279L,                            /*    Type:            Boolean*/
  329.                                                                 /*    Default value:    false - do not suppress character's automatic optical positional alignment*/
  330.     kATSUForceHangingTag        = 280L,                            /*    Type:            Boolean*/
  331.                                                                 /*    Default value:    false - do not force the character's to hang beyond the line boundaries*/
  332.     kATSUNoSpecialJustificationTag = 281L,                        /*    Type:            Boolean*/
  333.                                                                 /*    Default value:    false - perform post-compensation justification if needed*/
  334.     kATSUMaxATSUITagValue        = 65535L                        /*    This is the maximum Apple ATSUI reserved tag value.  Client defined tags must be larger.*/
  335. };
  336.  
  337. /********************************/
  338. /*    Enumerations and constants    */
  339. /********************************/
  340. /* Cursor movement */
  341.  
  342. enum {
  343.     kATSUByCharacter            = 0,
  344.     kATSUByCluster                = 1,
  345.     kATSUByWord                    = 2
  346. };
  347.  
  348. /* Vertical text types */
  349.  
  350. enum {
  351.     kATSUStronglyHorizontal        = 0,
  352.     kATSUStronglyVertical        = 1
  353. };
  354.  
  355. /* Line direction types (used for kATSULineDirectionTag values) */
  356.  
  357. enum {
  358.     kATSULeftToRightBaseDirection = 0,                            /*    Impose left-to-right or top-to-bottom dominant direction */
  359.     kATSURightToLeftBaseDirection = 1                            /*    Impose right-to-left or bottom-to-top dominant direction */
  360. };
  361.  
  362. /* Style comparison types */
  363.  
  364. enum {
  365.     kATSUStyleUnequal            = 0,
  366.     kATSUStyleContains            = 1,
  367.     kATSUStyleEquals            = 2,
  368.     kATSUStyleContainedBy        = 3
  369. };
  370.  
  371. /* LineFlushFactor convenience defined values */
  372. #define kATSUStartAlignment            ((Fract) 0x00000000L)
  373. #define kATSUEndAlignment            ((Fract) 0x40000000L)
  374. #define kATSUCenterAlignment        ((Fract) 0x20000000L)
  375. /* LineJustificationFactor convenience defined values */
  376. #define kATSUNoJustification        ((Fract) 0x00000000L)
  377. #define kATSUFullJustification        ((Fract) 0x40000000L)
  378. /* Other constants    */
  379.  
  380. enum {
  381.     kATSUInvalidFontID            = 0
  382. };
  383.  
  384.  
  385.  
  386. enum {
  387.     kATSUUseLineControlWidth    = 0x7FFFFFFF
  388. };
  389.  
  390.  
  391.  
  392. enum {
  393.     kATSUUseGrafPortPenLoc        = (long)0xFFFFFFFF,
  394.     kATSUClearAll                = (long)0xFFFFFFFF
  395. };
  396.  
  397.  
  398.  
  399. enum {
  400.     kATSUFromTextBeginning        = (long)0xFFFFFFFF,
  401.     kATSUToTextEnd                = (long)0xFFFFFFFF
  402. };
  403.  
  404.  
  405. /****************/
  406. /*    Functions    */
  407. /****************/
  408.  
  409. /*    Basic style functions    */
  410. EXTERN_API_C( OSStatus )
  411. ATSUCreateStyle                    (ATSUStyle *            oStyle);
  412.  
  413. EXTERN_API_C( OSStatus )
  414. ATSUCreateAndCopyStyle            (ATSUStyle                 iStyle,
  415.                                  ATSUStyle *            oStyle);
  416.  
  417. EXTERN_API_C( OSStatus )
  418. ATSUDisposeStyle                (ATSUStyle                 iStyle);
  419.  
  420. EXTERN_API_C( OSStatus )
  421. ATSUSetStyleRefCon                (ATSUStyle                 iStyle,
  422.                                  UInt32                 iRefCon);
  423.  
  424. EXTERN_API_C( OSStatus )
  425. ATSUGetStyleRefCon                (ATSUStyle                 iStyle,
  426.                                  UInt32 *                oRefCon);
  427.  
  428.  
  429. /*    Style comparison         */
  430. EXTERN_API_C( OSStatus )
  431. ATSUCompareStyles                (ATSUStyle                 iFirstStyle,
  432.                                  ATSUStyle                 iSecondStyle,
  433.                                  ATSUStyleComparison *    oComparison);
  434.  
  435. /*    Attribute manipulations    */
  436. EXTERN_API_C( OSStatus )
  437. ATSUCopyAttributes                (ATSUStyle                 iSourceStyle,
  438.                                  ATSUStyle                 iDestinationStyle);
  439.  
  440. EXTERN_API_C( OSStatus )
  441. ATSUOverwriteAttributes            (ATSUStyle                 iSourceStyle,
  442.                                  ATSUStyle                 iDestinationStyle);
  443.  
  444. EXTERN_API_C( OSStatus )
  445. ATSUUnderwriteAttributes        (ATSUStyle                 iSourceStyle,
  446.                                  ATSUStyle                 iDestinationStyle);
  447.  
  448. /*    Empty styles    */
  449. EXTERN_API_C( OSStatus )
  450. ATSUClearStyle                    (ATSUStyle                 iStyle);
  451.  
  452. EXTERN_API_C( OSStatus )
  453. ATSUStyleIsEmpty                (ATSUStyle                 iStyle,
  454.                                  Boolean *                isClear);
  455.  
  456. /*    Clipboard support    */
  457. EXTERN_API_C( OSStatus )
  458. ATSUCopyToHandle                (ATSUStyle                 iStyle,
  459.                                  Handle                 oStyleHandle);
  460.  
  461. EXTERN_API_C( OSStatus )
  462. ATSUPasteFromHandle                (ATSUStyle                 iStyle,
  463.                                  Handle                 iStyleHandle);
  464.  
  465. /*    Get and set attributes */
  466. EXTERN_API_C( OSStatus )
  467. ATSUCalculateBaselineDeltas        (ATSUStyle                 iStyle,
  468.                                  BslnBaselineClass         iBaselineClass,
  469.                                  BslnBaselineRecord     oBaselineDeltas);
  470.  
  471. EXTERN_API_C( OSStatus )
  472. ATSUSetAttributes                (ATSUStyle                 iStyle,
  473.                                  ItemCount                 iAttributeCount,
  474.                                  ATSUAttributeTag         iTag[],
  475.                                  ByteCount                 iValueSize[],
  476.                                  ATSUAttributeValuePtr     iValue[]);
  477.  
  478. EXTERN_API_C( OSStatus )
  479. ATSUGetAttribute                (ATSUStyle                 iStyle,
  480.                                  ATSUAttributeTag         iTag,
  481.                                  ByteCount                 iExpectedValueSize,
  482.                                  ATSUAttributeValuePtr     oValue,
  483.                                  ByteCount *            oActualValueSize);
  484.  
  485. EXTERN_API_C( OSStatus )
  486. ATSUGetAllAttributes            (ATSUStyle                 iStyle,
  487.                                  ATSUAttributeInfo         oAttributeInfoArray[],
  488.                                  ItemCount                 iTagValuePairArraySize,
  489.                                  ItemCount *            oTagValuePairCount);
  490.  
  491. EXTERN_API_C( OSStatus )
  492. ATSUClearAttributes                (ATSUStyle                 iStyle,
  493.                                  ItemCount                 iTagCount,
  494.                                  ATSUAttributeTag         iTag[]);
  495.  
  496. /*    Font features    */
  497. EXTERN_API_C( OSStatus )
  498. ATSUSetFontFeatures                (ATSUStyle                 iStyle,
  499.                                  ItemCount                 iFeatureCount,
  500.                                  ATSUFontFeatureType     iType[],
  501.                                  ATSUFontFeatureSelector  iSelector[]);
  502.  
  503. EXTERN_API_C( OSStatus )
  504. ATSUGetFontFeature                (ATSUStyle                 iStyle,
  505.                                  ItemCount                 iFeatureIndex,
  506.                                  ATSUFontFeatureType *    oFeatureType,
  507.                                  ATSUFontFeatureSelector * oFeatureSelector);
  508.  
  509. EXTERN_API_C( OSStatus )
  510. ATSUGetAllFontFeatures            (ATSUStyle                 iStyle,
  511.                                  ItemCount                 iMaximumFeatureCount,
  512.                                  ATSUFontFeatureType *    oFeatureType,
  513.                                  ATSUFontFeatureSelector * oFeatureSelector,
  514.                                  ItemCount *            oActualFeatureCount);
  515.  
  516. EXTERN_API_C( OSStatus )
  517. ATSUClearFontFeatures            (ATSUStyle                 iStyle,
  518.                                  ItemCount                 iFeatureCount,
  519.                                  ATSUFontFeatureType     iType[],
  520.                                  ATSUFontFeatureSelector  iSelector[]);
  521.  
  522. /*    Font variations    */
  523. EXTERN_API_C( OSStatus )
  524. ATSUSetVariations                (ATSUStyle                 iStyle,
  525.                                  ItemCount                 iVariationCount,
  526.                                  ATSUFontVariationAxis     iAxis[],
  527.                                  ATSUFontVariationValue  iValue[]);
  528.  
  529. EXTERN_API_C( OSStatus )
  530. ATSUGetFontVariationValue        (ATSUStyle                 iStyle,
  531.                                  ATSUFontVariationAxis     iATSUFontVariationAxis,
  532.                                  ATSUFontVariationValue * oATSUFontVariationValue);
  533.  
  534. EXTERN_API_C( OSStatus )
  535. ATSUGetAllFontVariations        (ATSUStyle                 iStyle,
  536.                                  ItemCount                 iVariationCount,
  537.                                  ATSUFontVariationAxis     oVariationAxes[],
  538.                                  ATSUFontVariationValue  oATSUFontVariationValues[],
  539.                                  ItemCount *            oActualVariationCount);
  540.  
  541. EXTERN_API_C( OSStatus )
  542. ATSUClearFontVariations            (ATSUStyle                 iStyle,
  543.                                  ItemCount                 iAxisCount,
  544.                                  ATSUFontVariationAxis     iAxis[]);
  545.  
  546. /*    Basic text-layout functions    */
  547. EXTERN_API_C( OSStatus )
  548. ATSUCreateTextLayout            (ATSUTextLayout *        oTextLayout);
  549.  
  550. EXTERN_API_C( OSStatus )
  551. ATSUCreateTextLayoutWithTextPtr    (ConstUniCharArrayPtr     iText,
  552.                                  UniCharArrayOffset     iTextOffset,
  553.                                  UniCharCount             iTextLength,
  554.                                  UniCharCount             iTextTotalLength,
  555.                                  ItemCount                 iNumberOfRuns,
  556.                                  UniCharCount             iRunLengths[],
  557.                                  ATSUStyle                 iStyles[],
  558.                                  ATSUTextLayout *        oTextLayout);
  559.  
  560. EXTERN_API_C( OSStatus )
  561. ATSUCreateTextLayoutWithTextHandle (UniCharArrayHandle     iText,
  562.                                  UniCharArrayOffset     iTextOffset,
  563.                                  UniCharCount             iTextLength,
  564.                                  UniCharCount             iTextTotalLength,
  565.                                  ItemCount                 iNumberOfRuns,
  566.                                  UniCharCount             iRunLengths[],
  567.                                  ATSUStyle                 iStyles[],
  568.                                  ATSUTextLayout *        oTextLayout);
  569.  
  570. EXTERN_API_C( OSStatus )
  571. ATSUDisposeTextLayout            (ATSUTextLayout         iTextLayout);
  572.  
  573. EXTERN_API_C( OSStatus )
  574. ATSUSetTextLayoutRefCon            (ATSUTextLayout         iTextLayout,
  575.                                  UInt32                 iRefCon);
  576.  
  577. EXTERN_API_C( OSStatus )
  578. ATSUGetTextLayoutRefCon            (ATSUTextLayout         iTextLayout,
  579.                                  UInt32 *                oRefCon);
  580.  
  581. /*    Text location    */
  582. EXTERN_API_C( OSStatus )
  583. ATSUSetTextPointerLocation        (ATSUTextLayout         iTextLayout,
  584.                                  ConstUniCharArrayPtr     iText,
  585.                                  UniCharArrayOffset     iTextOffset,
  586.                                  UniCharCount             iTextLength,
  587.                                  UniCharCount             iTextTotalLength);
  588.  
  589. EXTERN_API_C( OSStatus )
  590. ATSUSetTextHandleLocation        (ATSUTextLayout         iTextLayout,
  591.                                  UniCharArrayHandle     iText,
  592.                                  UniCharArrayOffset     iTextOffset,
  593.                                  UniCharCount             iTextLength,
  594.                                  UniCharCount             iTextTotalLength);
  595.  
  596. EXTERN_API_C( OSStatus )
  597. ATSUGetTextLocation                (ATSUTextLayout         iTextLayout,
  598.                                  void **                oText,
  599.                                  Boolean *                oTextIsStoredInHandle,
  600.                                  UniCharArrayOffset *    oOffset,
  601.                                  UniCharCount *            oTextLength,
  602.                                  UniCharCount *            oTextTotalLength);
  603.  
  604. /*    Text manipulation    */
  605. EXTERN_API_C( OSStatus )
  606. ATSUTextDeleted                    (ATSUTextLayout         iTextLayout,
  607.                                  UniCharArrayOffset     iDeletedRangeStart,
  608.                                  UniCharCount             iDeletedRangeLength);
  609.  
  610. EXTERN_API_C( OSStatus )
  611. ATSUTextInserted                (ATSUTextLayout         iTextLayout,
  612.                                  UniCharArrayOffset     iInsertionLocation,
  613.                                  UniCharCount             iInsertionLength);
  614.  
  615. EXTERN_API_C( OSStatus )
  616. ATSUTextMoved                    (ATSUTextLayout         iTextLayout,
  617.                                  ConstUniCharArrayPtr     iNewLocation);
  618.  
  619. /*    Layout controls    */
  620. EXTERN_API_C( OSStatus )
  621. ATSUCopyLayoutControls            (ATSUTextLayout         iSource,
  622.                                  ATSUTextLayout         iDest);
  623.  
  624. EXTERN_API_C( OSStatus )
  625. ATSUSetLayoutControls            (ATSUTextLayout         iLayout,
  626.                                  ItemCount                 iAttributeCount,
  627.                                  ATSUAttributeTag         iTag[],
  628.                                  ByteCount                 iValueSize[],
  629.                                  ATSUAttributeValuePtr     iValue[]);
  630.  
  631. EXTERN_API_C( OSStatus )
  632. ATSUGetLayoutControl            (ATSUTextLayout         iLayout,
  633.                                  ATSUAttributeTag         iTag,
  634.                                  ByteCount                 iExpectedValueSize,
  635.                                  ATSUAttributeValuePtr     oValue,
  636.                                  ByteCount *            oActualValueSize);
  637.  
  638. EXTERN_API_C( OSStatus )
  639. ATSUGetAllLayoutControls        (ATSUTextLayout         iLayout,
  640.                                  ATSUAttributeInfo         oAttributeInfoArray[],
  641.                                  ItemCount                 iTagValuePairArraySize,
  642.                                  ItemCount *            oTagValuePairCount);
  643.  
  644. EXTERN_API_C( OSStatus )
  645. ATSUClearLayoutControls            (ATSUTextLayout         iLayout,
  646.                                  ItemCount                 iTagCount,
  647.                                  ATSUAttributeTag         iTag[]);
  648.  
  649.  
  650.  
  651. /*    Style run processing    */
  652. EXTERN_API_C( OSStatus )
  653. ATSUSetRunStyle                    (ATSUTextLayout         iTextLayout,
  654.                                  ATSUStyle                 iStyle,
  655.                                  UniCharArrayOffset     iRunStart,
  656.                                  UniCharCount             iRunLength);
  657.  
  658. EXTERN_API_C( OSStatus )
  659. ATSUGetRunStyle                    (ATSUTextLayout         iTextLayout,
  660.                                  UniCharArrayOffset     iOffset,
  661.                                  ATSUStyle *            oStyle,
  662.                                  UniCharArrayOffset *    oRunStart,
  663.                                  UniCharCount *            oRunLength);
  664.  
  665. EXTERN_API_C( OSStatus )
  666. ATSUGetContinuousAttributes        (ATSUTextLayout         iTextLayout,
  667.                                  UniCharArrayOffset     iOffset,
  668.                                  UniCharCount             iLength,
  669.                                  ATSUStyle                 oStyle);
  670.  
  671. /*    Drawing and measuring    */
  672. EXTERN_API_C( OSStatus )
  673. ATSUDrawText                    (ATSUTextLayout         iTextLayout,
  674.                                  UniCharArrayOffset     iLineOffset,
  675.                                  UniCharCount             iLineLength,
  676.                                  ATSUTextMeasurement     iLocationX,
  677.                                  ATSUTextMeasurement     iLocationY);
  678.  
  679. EXTERN_API_C( OSStatus )
  680. ATSUMeasureText                    (ATSUTextLayout         iTextLayout,
  681.                                  UniCharArrayOffset     iLineStart,
  682.                                  UniCharCount             iLineLength,
  683.                                  ATSUTextMeasurement *    oTextBefore,
  684.                                  ATSUTextMeasurement *    oTextAfter,
  685.                                  ATSUTextMeasurement *    oAscent,
  686.                                  ATSUTextMeasurement *    oDescent);
  687.  
  688. EXTERN_API_C( OSStatus )
  689. ATSUMeasureTextImage            (ATSUTextLayout         iTextLayout,
  690.                                  UniCharArrayOffset     iLineOffset,
  691.                                  UniCharCount             iLineLength,
  692.                                  ATSUTextMeasurement     iLocationX,
  693.                                  ATSUTextMeasurement     iLocationY,
  694.                                  Rect *                    oTextImageRect);
  695.  
  696. /*    Highlighting    */
  697. EXTERN_API_C( OSStatus )
  698. ATSUHighlightText                (ATSUTextLayout         iTextLayout,
  699.                                  ATSUTextMeasurement     iTextBasePointX,
  700.                                  ATSUTextMeasurement     iTextBasePointY,
  701.                                  UniCharArrayOffset     iHighlightStart,
  702.                                  UniCharCount             iHighlightLength);
  703.  
  704. EXTERN_API_C( OSStatus )
  705. ATSUUnhighlightText                (ATSUTextLayout         iTextLayout,
  706.                                  ATSUTextMeasurement     iTextBasePointX,
  707.                                  ATSUTextMeasurement     iTextBasePointY,
  708.                                  UniCharArrayOffset     iHighlightStart,
  709.                                  UniCharCount             iHighlightLength);
  710.  
  711. EXTERN_API_C( OSStatus )
  712. ATSUGetTextHighlight            (ATSUTextLayout         iTextLayout,
  713.                                  ATSUTextMeasurement     iTextBasePointX,
  714.                                  ATSUTextMeasurement     iTextBasePointY,
  715.                                  UniCharArrayOffset     iHighlightStart,
  716.                                  UniCharCount             iHighlightLength,
  717.                                  RgnHandle                 oHighlightRegion);
  718.  
  719. /*    Hit-testing    */
  720. EXTERN_API_C( OSStatus )
  721. ATSUPositionToOffset            (ATSUTextLayout         iTextLayout,
  722.                                  ATSUTextMeasurement     iLocationX,
  723.                                  ATSUTextMeasurement     iLocationY,
  724.                                  UniCharArrayOffset *    ioPrimaryOffset,
  725.                                  Boolean *                oIsLeading,
  726.                                  UniCharArrayOffset *    oSecondaryOffset);
  727.  
  728. EXTERN_API_C( OSStatus )
  729. ATSUOffsetToPosition            (ATSUTextLayout         iTextLayout,
  730.                                  UniCharArrayOffset     iOffset,
  731.                                  Boolean                 iIsLeading,
  732.                                  ATSUCaret *            oMainCaret,
  733.                                  ATSUCaret *            oSecondCaret,
  734.                                  Boolean *                oCaretIsSplit);
  735.  
  736. /*    Cursor movement    */
  737. EXTERN_API_C( OSStatus )
  738. ATSUNextCursorPosition            (ATSUTextLayout         iTextLayout,
  739.                                  UniCharArrayOffset     iOldOffset,
  740.                                  ATSUCursorMovementType  iMovementType,
  741.                                  UniCharArrayOffset *    oNewOffset);
  742.  
  743. EXTERN_API_C( OSStatus )
  744. ATSUPreviousCursorPosition        (ATSUTextLayout         iTextLayout,
  745.                                  UniCharArrayOffset     iOldOffset,
  746.                                  ATSUCursorMovementType  iMovementType,
  747.                                  UniCharArrayOffset *    oNewOffset);
  748.  
  749. EXTERN_API_C( OSStatus )
  750. ATSURightwardCursorPosition        (ATSUTextLayout         iTextLayout,
  751.                                  UniCharArrayOffset     iOldOffset,
  752.                                  ATSUCursorMovementType  iMovementType,
  753.                                  UniCharArrayOffset *    oNewOffset);
  754.  
  755. EXTERN_API_C( OSStatus )
  756. ATSULeftwardCursorPosition        (ATSUTextLayout         iTextLayout,
  757.                                  UniCharArrayOffset     iOldOffset,
  758.                                  ATSUCursorMovementType  iMovementType,
  759.                                  UniCharArrayOffset *    oNewOffset);
  760.  
  761. /*    Line breaking    */
  762. EXTERN_API_C( OSStatus )
  763. ATSUBreakLine                    (ATSUTextLayout         iTextLayout,
  764.                                  UniCharArrayOffset     iLineStart,
  765.                                  ATSUTextMeasurement     iLineWidth,
  766.                                  Boolean                 iUseAsSoftLineBreak,
  767.                                  UniCharArrayOffset *    oLineBreak);
  768.  
  769. EXTERN_API_C( OSStatus )
  770. ATSUSetSoftLineBreak            (ATSUTextLayout         iTextLayout,
  771.                                  UniCharArrayOffset     iLineBreak);
  772.  
  773. EXTERN_API_C( OSStatus )
  774. ATSUGetSoftLineBreaks            (ATSUTextLayout         iTextLayout,
  775.                                  UniCharArrayOffset     iRangeStart,
  776.                                  UniCharCount             iRangeLength,
  777.                                  ItemCount                 iMaximumBreaks,
  778.                                  UniCharArrayOffset     oBreaks[],
  779.                                  ItemCount *            oBreakCount);
  780.  
  781. EXTERN_API_C( OSStatus )
  782. ATSUClearSoftLineBreaks            (ATSUTextLayout         iTextLayout,
  783.                                  UniCharArrayOffset     iRangeStart,
  784.                                  UniCharCount             iRangeLength);
  785.  
  786. /*    Idle processing    */
  787. EXTERN_API_C( OSStatus )
  788. ATSUIdle                        (ATSUTextLayout         iTextLayout);
  789.  
  790. /*    Font matching    */
  791. EXTERN_API_C( OSStatus )
  792. ATSUMatchFontsToText            (ATSUTextLayout         iTextLayout,
  793.                                  UniCharArrayOffset     iTextStart,
  794.                                  UniCharCount             iTextLength,
  795.                                  ATSUFontID *            oFont,
  796.                                  UniCharArrayOffset *    oChangedOffset,
  797.                                  UniCharCount *            oChangedLength);
  798.  
  799. EXTERN_API_C( OSStatus )
  800. ATSUSetTransientFontMatching    (ATSUTextLayout         iTextLayout,
  801.                                  Boolean                 iTransientFontMatching);
  802.  
  803. EXTERN_API_C( OSStatus )
  804. ATSUGetTransientFontMatching    (ATSUTextLayout         iTextLayout,
  805.                                  Boolean *                oTransientFontMatching);
  806.  
  807. /*    Font ID's    */
  808. EXTERN_API_C( OSStatus )
  809. ATSUFontCount                    (ItemCount *            oFontCount);
  810.  
  811. EXTERN_API_C( OSStatus )
  812. ATSUGetFontIDs                    (ATSUFontID             oFontIDs[],
  813.                                  ItemCount                 iArraySize,
  814.                                  ItemCount *            oFontCount);
  815.  
  816. EXTERN_API_C( OSStatus )
  817. ATSUFONDtoFontID                (short                     iFONDNumber,
  818.                                  Style                     iFONDStyle,
  819.                                  ATSUFontID *            oFontID);
  820.  
  821. EXTERN_API_C( OSStatus )
  822. ATSUFontIDtoFOND                (ATSUFontID             iFontID,
  823.                                  short *                oFONDNumber,
  824.                                  Style *                oFONDStyle);
  825.  
  826. /*    Font names    */
  827. EXTERN_API_C( OSStatus )
  828. ATSUCountFontNames                (ATSUFontID             iFontID,
  829.                                  ItemCount *            oFontNameCount);
  830.  
  831. EXTERN_API_C( OSStatus )
  832. ATSUGetIndFontName                (ATSUFontID             iFontID,
  833.                                  ItemCount                 iFontNameIndex,
  834.                                  ByteCount                 iMaximumNameLength,
  835.                                  Ptr                     oName,
  836.                                  ByteCount *            oActualNameLength,
  837.                                  FontNameCode *            oFontNameCode,
  838.                                  FontPlatformCode *        oFontNamePlatform,
  839.                                  FontScriptCode *        oFontNameScript,
  840.                                  FontLanguageCode *        oFontNameLenguage);
  841.  
  842. EXTERN_API_C( OSStatus )
  843. ATSUFindFontName                (ATSUFontID             iFontID,
  844.                                  FontNameCode             iFontNameCode,
  845.                                  FontPlatformCode         iFontNamePlatform,
  846.                                  FontScriptCode         iFontNameScript,
  847.                                  FontLanguageCode         iFontNameLanguage,
  848.                                  ByteCount                 iMaximumNameLength,
  849.                                  Ptr                     oName,
  850.                                  ByteCount *            oActualNameLength,
  851.                                  ItemCount *            oFontNameIndex);
  852.  
  853. EXTERN_API_C( OSStatus )
  854. ATSUFindFontFromName            (Ptr                     iName,
  855.                                  ByteCount                 iNameLength,
  856.                                  FontNameCode             iFontNameCode,
  857.                                  FontPlatformCode         iFontNamePlatform,
  858.                                  FontScriptCode         iFontNameScript,
  859.                                  FontLanguageCode         iFontNameLanguage,
  860.                                  ATSUFontID *            oFontID);
  861.  
  862. /*    Font features    */
  863. EXTERN_API_C( OSStatus )
  864. ATSUCountFontFeatureTypes        (ATSUFontID             iFont,
  865.                                  ItemCount *            oTypeCount);
  866.  
  867. EXTERN_API_C( OSStatus )
  868. ATSUCountFontFeatureSelectors    (ATSUFontID             iFont,
  869.                                  ATSUFontFeatureType     iType,
  870.                                  ItemCount *            oSelectorCount);
  871.  
  872. EXTERN_API_C( OSStatus )
  873. ATSUGetFontFeatureTypes            (ATSUFontID             iFont,
  874.                                  ItemCount                 iMaximumTypes,
  875.                                  ATSUFontFeatureType     oTypes[],
  876.                                  ItemCount *            oActualTypeCount);
  877.  
  878. EXTERN_API_C( OSStatus )
  879. ATSUGetFontFeatureSelectors        (ATSUFontID             iFont,
  880.                                  ATSUFontFeatureType     iType,
  881.                                  ItemCount                 iMaximumSelectors,
  882.                                  ATSUFontFeatureSelector  oSelectors[],
  883.                                  Boolean                 oSelectorIsOnByDefault[],
  884.                                  ItemCount *            oActualSelectorCount,
  885.                                  Boolean *                oIsMutuallyExclusive);
  886.  
  887. EXTERN_API_C( OSStatus )
  888. ATSUGetFontFeatureNameCode        (ATSUFontID             iFont,
  889.                                  ATSUFontFeatureType     iType,
  890.                                  ATSUFontFeatureSelector  iSelector,
  891.                                  FontNameCode *            oNameCode);
  892.  
  893. /*    Font variations    */
  894. EXTERN_API_C( OSStatus )
  895. ATSUCountFontVariations            (ATSUFontID             iFont,
  896.                                  ItemCount *            oVariationCount);
  897.  
  898. EXTERN_API_C( OSStatus )
  899. ATSUGetIndFontVariation            (ATSUFontID             iFont,
  900.                                  ItemCount                 iVariationIndex,
  901.                                  ATSUFontVariationAxis * oATSUFontVariationAxis,
  902.                                  ATSUFontVariationValue * oMinimumValue,
  903.                                  ATSUFontVariationValue * oMaximumValue,
  904.                                  ATSUFontVariationValue * oDefaultValue);
  905.  
  906. EXTERN_API_C( OSStatus )
  907. ATSUGetFontVariationNameCode    (ATSUFontID             iFont,
  908.                                  ATSUFontVariationAxis     iAxis,
  909.                                  FontNameCode *            oNameCode);
  910.  
  911.  
  912. /*    Font Instances    */
  913. EXTERN_API_C( OSStatus )
  914. ATSUCountFontInstances            (ATSUFontID             iFont,
  915.                                  ItemCount *            oInstances);
  916.  
  917. EXTERN_API_C( OSStatus )
  918. ATSUGetFontInstance                (ATSUFontID             iFont,
  919.                                  ItemCount                 iFontInstanceIndex,
  920.                                  ItemCount                 iMaximumVariations,
  921.                                  ATSUFontVariationAxis     oAxes[],
  922.                                  ATSUFontVariationValue  oValues[],
  923.                                  ItemCount *            oActualVariationCount);
  924.  
  925. EXTERN_API_C( OSStatus )
  926. ATSUGetFontInstanceNameCode        (ATSUFontID             iFont,
  927.                                  ItemCount                 iInstanceIndex,
  928.                                  FontNameCode *            oNameCode);
  929.  
  930.  
  931. #if PRAGMA_STRUCT_ALIGN
  932.     #pragma options align=reset
  933. #elif PRAGMA_STRUCT_PACKPUSH
  934.     #pragma pack(pop)
  935. #elif PRAGMA_STRUCT_PACK
  936.     #pragma pack()
  937. #endif
  938.  
  939. #ifdef PRAGMA_IMPORT_OFF
  940. #pragma import off
  941. #elif PRAGMA_IMPORT
  942. #pragma import reset
  943. #endif
  944.  
  945. #ifdef __cplusplus
  946. }
  947. #endif
  948.  
  949. #endif /* __ATSUNICODE__ */
  950.  
  951.